package com.ssy.jt808.gateway.domain.converter;

import com.ssy.jt808.gateway.domain.pojo.TerminalInfo;
import com.ssy.jt808.gateway.sdk.terminal.message.location.T0200DataMessage;
import io.netty.buffer.ByteBuf;

/**
 * @author zeno
 */
public class T0200MessageConverter{
  public static void updateT0200DataMessage( T0200DataMessage t0200DataMessage,
                                             ByteBuf payload,
                                             TerminalInfo terminalInfo ){

    t0200DataMessage.setTerminalId(terminalInfo.getTerminalId());
    t0200DataMessage.setVehicleId(terminalInfo.getVehicleId());
    t0200DataMessage.setTerminalPhoneNo(terminalInfo.getPhoneNo());
    t0200DataMessage.setPlateNo(terminalInfo.getPlateNo());

    byte[] data = new byte[payload.readableBytes()];
    payload.readBytes(data);
    t0200DataMessage.setData(data);
  }
}
